home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WFC010.ZIP / SRC / CNETINFO.CPP < prev    next >
C/C++ Source or Header  |  1995-12-07  |  3KB  |  112 lines

  1. #include <wfc.h>
  2. #pragma hdrstop
  3.  
  4. /*
  5. ** Author: Samuel R. Blackburn
  6. ** CI$: 76300,326
  7. ** Internet: sammy@sed.csc.com
  8. **
  9. ** You can use it any way you like as long as you don't try to sell it.
  10. **
  11. ** Any attempt to sell WFC in source code form must have the permission
  12. ** of the original author. You can produce commercial executables with
  13. ** WFC but you can't sell WFC.
  14. **
  15. ** Copyright, 1995, Samuel R. Blackburn
  16. **
  17. ** $Workfile: $
  18. ** $Revision: $
  19. ** $Modtime: $
  20. */
  21.  
  22. #if defined( _DEBUG )
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. #if defined( _DEBUG )
  28. #define new DEBUG_NEW
  29. #endif
  30.  
  31. /*
  32. ** CNetInformation stuff
  33. */
  34.  
  35. CNetworkInformation::CNetworkInformation()
  36. {
  37.    Empty();
  38. }
  39.  
  40. CNetworkInformation::CNetworkInformation( const NETINFOSTRUCT *source )
  41. {
  42.    Empty();
  43.    Copy( source );
  44. }
  45.  
  46. CNetworkInformation::CNetworkInformation( const CNetworkInformation& source )
  47. {
  48.    Empty();
  49.    Copy( source );
  50. }
  51.  
  52. CNetworkInformation::~CNetworkInformation()
  53. {
  54.    Empty();
  55. }
  56.  
  57. void CNetworkInformation::Copy( const NETINFOSTRUCT * source )
  58. {
  59.    ASSERT( source != NULL );
  60.  
  61.    if ( source == NULL )
  62.    {
  63.       Empty();
  64.       return;
  65.    }
  66.  
  67.    cbStructure       = source->cbStructure;
  68.    dwProviderVersion = source->dwProviderVersion;
  69.    dwStatus          = source->dwStatus;
  70.    dwCharacteristics = source->dwCharacteristics;
  71.    dwHandle          = source->dwHandle;
  72.    wNetType          = source->wNetType;
  73.    dwPrinters        = source->dwPrinters;
  74.    dwDrives          = source->dwDrives;
  75. }
  76.  
  77. void CNetworkInformation::Copy( const CNetworkInformation& source )
  78. {
  79.    Copy( (const NETINFOSTRUCT *) &source );
  80. }
  81.  
  82. #if defined( _DEBUG )
  83.  
  84. void CNetworkInformation::Dump( CDumpContext& dump_context ) const
  85. {
  86.    dump_context << " a CNetworkInformation at " << (void *) this << "\n";
  87.    dump_context << "{\n";
  88.    dump_context << "   cbStructure       = " << cbStructure       << "\n";
  89.    dump_context << "   dwProviderVersion = " << dwProviderVersion << "\n";
  90.    dump_context << "   dwStatus          = " << dwStatus          << "\n";
  91.    dump_context << "   dwCharacteristics = " << dwCharacteristics << "\n";
  92.    dump_context << "   dwHandle          = " << dwHandle          << "\n";
  93.    dump_context << "   wNetType          = " << wNetType          << "\n";
  94.    dump_context << "   dwPrinters        = " << dwPrinters        << "\n";
  95.    dump_context << "   dwDrives          = " << dwDrives          << "\n";
  96.    dump_context << "}\n";
  97. }
  98.  
  99. #endif // _DEBUG
  100.  
  101. void CNetworkInformation::Empty( void )
  102. {
  103.    cbStructure       = sizeof( NETINFOSTRUCT );
  104.    dwProviderVersion = 0;
  105.    dwStatus          = 0;
  106.    dwCharacteristics = 0;
  107.    dwHandle          = 0;
  108.    wNetType          = 0;
  109.    dwPrinters        = 0;
  110.    dwDrives          = 0;
  111. }
  112.